<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <h1>今天天气很{{ info }}</h1>
        <button @click="changeWeather">切换天气</button>
    </div>
    <script src="../JS/vue.js"></script>
    <script>
        new Vue({
            el: '#app',
            data() {
                return {
                    isHot:true
                }
            },
            computed:{
                info(){
                    return this.isHot ? '炎热' : '凉爽' 
                }
            },
            methods: {
                changeWeather(){
                    this.isHot = !this.isHot
                }
            },
            watch:{
                isHot:{
                    handler(newValue,oldValue){
                        console.log('isHot被修改了',newValue,oldValue);
                    }
                }
            }
        })
    </script>
</body>

</html>